var d1 = require('deviceone');
var album = d1.sm("do_Album");
var net = require('util/net');
var notify = d1.sm("do_Notification");
var log = require("util/log")
module.exports.uploadImage = function(options,callback) {
	options = options || {}

	album.select({
		maxCount : options.maxCount || 1,
		width : options.width || 180,
		height : options.height || -1,
		quality : 80,
		iscut : options.iscut===undefined?true:options.iscut
	}, function(data, e) {
		net.upload({
			file : data,
			success : function(d) {
				callback.call(options.scope,d)
				notify.toast('上传成功')
			},
			error : function(d) {
				log.info(d)
			}
		})
	})
}